home *** CD-ROM | disk | FTP | other *** search
/ BMUG Revelations / BMUG Revelations.toast / Programming / Programming Languages / Harvest C / MPW Int & Lib / Interfaces / PrintTraps.h < prev    next >
Text File  |  1991-04-17  |  11KB  |  343 lines

  1. /************************************************************
  2.  
  3. Created: Thursday, September 7, 1989 at 5:45 PM
  4.     PrintTraps.h
  5.     C Interface to the Macintosh Libraries
  6.  
  7.  
  8.     Copyright Apple Computer, Inc.    1985-1989
  9.     All rights reserved
  10.  
  11. ************************************************************/
  12.  
  13.  
  14. #ifndef __PRINTTRAPS__
  15. #define __PRINTTRAPS__
  16.  
  17. #ifndef __QUICKDRAW__
  18. #include <Quickdraw.h>
  19. #endif
  20.  
  21. #ifndef __DIALOGS__
  22. #include <Dialogs.h>
  23. #endif
  24.  
  25. enum {bDraftLoop = 0};
  26. enum {bSpoolLoop = 1};
  27. enum {iPFMaxPgs = 128};             /*Max number of pages in a print file.*/
  28. enum {iPrPgFract = 120};
  29. enum {iPrPgFst = 1};                /*Page range constants*/
  30. enum {iPrPgMax = 9999};
  31. enum {iPrRelease = 2};              /*Current version number of the code.*/
  32. enum {iPrSavPFil = -1};
  33. enum {iIOAbort = -27};
  34. enum {pPrGlobals = 0x00000944};
  35. enum {bUser1Loop = 2};
  36. enum {bUser2Loop = 3};
  37. enum {fNewRunBit = 2};              /*Bit 2 (3rd bit) in bDocLoop is new JobRun indicator.*/
  38. enum {fHiResOK = 3};                /*Bit 3 (4th bit) in bDocLoop is hi res indicator for paint.*/
  39. enum {fWeOpenedRF = 4};             /*Bit 4 (5th bit) in bDocLoop is set if driver opened the pr res file.*/
  40. enum {iPrAbort = 128};
  41. enum {iPrDevCtl = 7};               /*The PrDevCtl Proc's ctl number*/
  42. enum {lPrReset = 0x00010000};       /*The PrDevCtl Proc's CParam for reset*/
  43. enum {lPrLineFeed = 0x00030000};
  44. enum {lPrLFStd = 0x0003FFFF};       /*The PrDevCtl Proc's CParam for std paper advance*/
  45. enum {lPrLFSixth = 0x0003FFFF};
  46. enum {lPrPageEnd = 0x00020000};     /*The PrDevCtl Proc's CParam for end page*/
  47. enum {lPrDocOpen = 0x00010000};     /*note: same as lPrReset low order byte indicates number of copies to print*/
  48. enum {lPrPageOpen = 0x00040000};
  49. enum {lPrPageClose = 0x00020000};   /*note: same as lPrPageEnd*/
  50. enum {lPrDocClose = 0x00050000};
  51. enum {iFMgrCtl = 8};                /*The FMgr's Tail-hook Proc's ctl number*/
  52. enum {iMscCtl = 9};                 /*Msc Text state / Drvr State ctl number*/
  53. enum {iPvtCtl = 10};                /*Private ctls start here*/
  54. enum {iMemFullErr = -108};
  55.  
  56. /*
  57. Driver constants */
  58.  
  59. enum {iPrBitsCtl = 4};              /*The Bitmap Print Proc's ctl number*/
  60. enum {lScreenBits = 0};             /*The Bitmap Print Proc's Screen Bitmap param*/
  61. enum {lPaintBits = 1};              /*The Bitmap Print Proc's Paint [sq pix] param*/
  62. enum {lHiScreenBits = 0x00000002};  /*The Bitmap Print Proc's Screen Bitmap param*/
  63. enum {lHiPaintBits = 0x00000003};   /*The Bitmap Print Proc's Paint [sq pix] param*/
  64. enum {iPrIOCtl = 5};                /*The Raw Byte IO Proc's ctl number*/
  65. enum {iPrEvtCtl = 6};               /*The PrEvent Proc's ctl number*/
  66. enum {lPrEvtAll = 0x0002FFFD};      /*The PrEvent Proc's CParam for the entire screen*/
  67. enum {lPrEvtTop = 0x0001FFFD};      /*The PrEvent Proc's CParam for the top folder*/
  68. #define sPrDrvr ".Print"
  69. enum {iPrDrvrRef = -3};
  70. enum {getRslDataOp = 4};            /*PrGeneral Cs*/
  71. enum {setRslOp = 5};                /*PrGeneral Cs*/
  72. enum {draftBitsOp = 6};             /*PrGeneral Cs*/
  73. enum {noDraftBitsOp = 7};           /*PrGeneral Cs*/
  74. enum {getRotnOp = 8};               /*PrGeneral Cs*/
  75. enum {NoSuchRsl = 1};               /*PrGeneral Cs*/
  76. enum {RgType1 = 1};                 /*PrGeneral Cs*/
  77.  
  78. enum {feedCut,feedFanfold,feedMechCut,feedOther};
  79. typedef unsigned char TFeed;
  80.  
  81. enum {scanTB,scanBT,scanLR,scanRL};
  82. typedef unsigned char TScan;
  83.  
  84. typedef Rect *TPRect;
  85.  
  86. typedef pascal void (*PrIdleProcPtr)(void);
  87. typedef pascal void (*PItemProcPtr)(DialogPtr theDialog, short item);
  88.  
  89. struct TPrPort {
  90.     GrafPort gPort;                 /*The Printer's graf port.*/
  91.     QDProcs gProcs;                 /*..and its procs*/
  92.     long lGParam1;                    /*16 bytes for private parameter storage.*/
  93.     long lGParam2;
  94.     long lGParam3;
  95.     long lGParam4;
  96.     Boolean fOurPtr;                /*Whether the PrPort allocation was done by us.*/
  97.     Boolean fOurBits;                /*Whether the BitMap allocation was done by us.*/
  98. };
  99.  
  100. typedef struct TPrPort TPrPort;
  101. typedef TPrPort *TPPrPort;
  102.  
  103. /* Printing Graf Port. All printer imaging, whether spooling, banding, etc, happens "thru" a GrafPort.
  104. This is the "PrPeek" record. */
  105. struct TPrInfo {
  106.     short iDev;                     /*Font mgr/QuickDraw device code*/
  107.     short iVRes;                    /*Resolution of device, in device coordinates*/
  108.     short iHRes;                    /*..note: V before H => compatable with Point.*/
  109.     Rect rPage;                     /*The page (printable) rectangle in device coordinates.*/
  110. };
  111.  
  112. typedef struct TPrInfo TPrInfo;
  113. typedef TPrInfo *TPPrInfo;
  114.  
  115. /* Print Info Record: The parameters needed for page composition. */
  116. struct TPrStl {
  117.     short wDev;                     /*The device (driver) number. Hi byte=RefNum, Lo byte=variant. f0 = fHiRes f1 = fPortrait, f2 = fSqPix, f3 = f2xZoom, f4 = fScroll.*/
  118.     short iPageV;                    /*paper size in units of 1/iPrPgFract*/
  119.     short iPageH;                    /* ..note: V before H => compatable with Point.*/
  120.     char bPort;                     /*The IO port number. Refnum?*/
  121.     TFeed feed;                     /*paper feeder type.*/
  122. };
  123.  
  124. typedef struct TPrStl TPrStl;
  125. typedef TPrStl *TPPrStl;
  126.  
  127. /* Printer Style: The printer configuration and usage information. */
  128. struct TPrXInfo {
  129.     short iRowBytes;
  130.     short iBandV;
  131.     short iBandH;
  132.     short iDevBytes;
  133.     short iBands;
  134.     char bPatScale;
  135.     char bUlThick;
  136.     char bUlOffset;
  137.     char bUlShadow;
  138.     TScan scan;
  139.     char bXInfoX;
  140. };
  141.  
  142. typedef struct TPrXInfo TPrXInfo;
  143. typedef TPrXInfo *TPPrXInfo;
  144.  
  145. struct TPrJob {
  146.     short iFstPage;
  147.     short iLstPage;
  148.     short iCopies;
  149.     char bJDocLoop;
  150.     Boolean fFromUsr;
  151.     PrIdleProcPtr pIdleProc;
  152.     StringPtr pFileName;
  153.     short iFileVol;
  154.     char bFileVers;
  155.     char bJobX;
  156. };
  157.  
  158. typedef struct TPrJob TPrJob;
  159. typedef TPrJob *TPPrJob;
  160.  
  161. struct TPrint {
  162.     short iPrVersion;                /*(2) Printing software version*/
  163.     TPrInfo prInfo;                 /*(14) the PrInfo data associated with the current style.*/
  164.     Rect rPaper;                    /*(8) The paper rectangle [offset from rPage]*/
  165.     TPrStl prStl;                    /*(8)  This print request's style.*/
  166.     TPrInfo prInfoPT;                /*(14)    Print Time Imaging metrics*/
  167.     TPrXInfo prXInfo;                /*(16)    Print-time (expanded) Print info record.*/
  168.     TPrJob prJob;                    /*(20) The Print Job request (82)  Total of the above; 120-82 = 38 bytes needed to fill 120*/
  169.     short printX[19];                /*Spare to fill to 120 bytes!*/
  170. };
  171.  
  172. typedef struct TPrint TPrint;
  173. typedef TPrint *TPPrint, **THPrint;
  174.  
  175. /* The universal 120 byte printing record */
  176. struct TPrStatus {
  177.     short iTotPages;                /*Total pages in Print File.*/
  178.     short iCurPage;                 /*Current page number*/
  179.     short iTotCopies;                /*Total copies requested*/
  180.     short iCurCopy;                 /*Current copy number*/
  181.     short iTotBands;                /*Total bands per page.*/
  182.     short iCurBand;                 /*Current band number*/
  183.     Boolean fPgDirty;                /*True if current page has been written to.*/
  184.     Boolean fImaging;                /*Set while in band's DrawPic call.*/
  185.     THPrint hPrint;                 /*Handle to the active Printer record*/
  186.     TPPrPort pPrPort;                /*Ptr to the active PrPort*/
  187.     PicHandle hPic;                 /*Handle to the active Picture*/
  188. };
  189.  
  190. typedef struct TPrStatus TPrStatus;
  191. typedef TPrStatus *TPPrStatus;
  192.  
  193. /* Print Status: Print information during printing. */
  194. struct TPfPgDir {
  195.     short iPages;
  196.     long iPgPos[129];                /*ARRAY [0..iPfMaxPgs] OF LONGINT*/
  197. };
  198.  
  199. typedef struct TPfPgDir TPfPgDir;
  200. typedef TPfPgDir *TPPfPgDir, **THPfPgDir;
  201.  
  202. /* PicFile = a TPfHeader followed by n QuickDraw Pics (whose PicSize is invalid!) */
  203. struct TPrDlg {
  204.     DialogRecord Dlg;                /*The Dialog window*/
  205.     ModalFilterProcPtr pFltrProc;    /*The Filter Proc.*/
  206.     PItemProcPtr pItemProc;         /*The Item evaluating proc.*/
  207.     THPrint hPrintUsr;                /*The user's print record.*/
  208.     Boolean fDoIt;
  209.     Boolean fDone;
  210.     long lUser1;                    /*Four longs for user's to hang global data.*/
  211.     long lUser2;                    /*...Plus more stuff needed by the particular printing dialog.*/
  212.     long lUser3;
  213.     long lUser4;
  214. };
  215.  
  216. typedef struct TPrDlg TPrDlg;
  217. typedef TPrDlg *TPPrDlg;
  218.  
  219. typedef pascal TPPrDlg (*PDlgInitProcPtr)(THPrint hPrint);
  220.  
  221. /* This is the Printing Dialog Record. Only used by folks appending their own dialogs.
  222. Print Dialog: The Dialog Stream object. */
  223.  
  224.  
  225. struct TGnlData {
  226.     short iOpCode;
  227.     short iError;
  228.     long lReserved;                 /*more fields here depending on call*/
  229. };
  230.  
  231. typedef struct TGnlData TGnlData;
  232. struct TRslRg {
  233.     short iMin;
  234.     short iMax;
  235. };
  236.  
  237. typedef struct TRslRg TRslRg;
  238. struct TRslRec {
  239.     short iXRsl;
  240.     short iYRsl;
  241. };
  242.  
  243. typedef struct TRslRec TRslRec;
  244. struct TGetRslBlk {
  245.     short iOpCode;
  246.     short iError;
  247.     long lReserved;
  248.     short iRgType;
  249.     TRslRg xRslRg;
  250.     TRslRg yRslRg;
  251.     short iRslRecCnt;
  252.     TRslRec rgRslRec[27];
  253. };
  254.  
  255. typedef struct TGetRslBlk TGetRslBlk;
  256. struct TSetRslBlk {
  257.     short iOpCode;
  258.     short iError;
  259.     long lReserved;
  260.     THPrint hPrint;
  261.     short iXRsl;
  262.     short iYRsl;
  263. };
  264.  
  265. typedef struct TSetRslBlk TSetRslBlk;
  266. struct TDftBitsBlk {
  267.     short iOpCode;
  268.     short iError;
  269.     long lReserved;
  270.     THPrint hPrint;
  271. };
  272.  
  273. typedef struct TDftBitsBlk TDftBitsBlk;
  274. struct TGetRotnBlk {
  275.     short iOpCode;
  276.     short iError;
  277.     long lReserved;
  278.     THPrint hPrint;
  279.     Boolean fLandscape;
  280.     char bXtra;
  281. };
  282.  
  283. typedef struct TGetRotnBlk TGetRotnBlk;
  284. #ifdef __cplusplus
  285. extern "C" {
  286. #endif
  287. pascal void PrPurge(void)
  288.     = {0x2F3C,0xA800,0x0000,0xA8FD};
  289. pascal void PrNoPurge(void)
  290.     = {0x2F3C,0xB000,0x0000,0xA8FD};
  291. pascal Handle PrDrvrDCE(void)
  292.     = {0x2F3C,0x9400,0x0000,0xA8FD};
  293. pascal short PrDrvrVers(void)
  294.     = {0x2F3C,0x9A00,0x0000,0xA8FD};
  295. pascal void PrOpen(void)
  296.     = {0x2F3C,0xC800,0x0000,0xA8FD};
  297. pascal void PrClose(void)
  298.     = {0x2F3C,0xD000,0x0000,0xA8FD};
  299. pascal void PrintDefault(THPrint hPrint)
  300.     = {0x2F3C,0x2004,0x0480,0xA8FD};
  301. pascal Boolean PrValidate(THPrint hPrint)
  302.     = {0x2F3C,0x5204,0x0498,0xA8FD};
  303. pascal Boolean PrStlDialog(THPrint hPrint)
  304.     = {0x2F3C,0x2A04,0x0484,0xA8FD};
  305. pascal Boolean PrJobDialog(THPrint hPrint)
  306.     = {0x2F3C,0x3204,0x0488,0xA8FD};
  307. pascal void PrJobMerge(THPrint hPrintSrc,THPrint hPrintDst)
  308.     = {0x2F3C,0x5804,0x089C,0xA8FD};
  309. pascal TPPrPort PrOpenDoc(THPrint hPrint,TPPrPort pPrPort,Ptr pIOBuf)
  310.     = {0x2F3C,0x0400,0x0C00,0xA8FD};
  311. pascal void PrCloseDoc(TPPrPort pPrPort)
  312.     = {0x2F3C,0x0800,0x0484,0xA8FD};
  313. pascal void PrOpenPage(TPPrPort pPrPort,TPRect pPageFrame)
  314.     = {0x2F3C,0x1000,0x0808,0xA8FD};
  315. pascal void PrClosePage(TPPrPort pPrPort)
  316.     = {0x2F3C,0x1800,0x040C,0xA8FD};
  317. pascal void PrPicFile(THPrint hPrint,TPPrPort pPrPort,Ptr pIOBuf,Ptr pDevBuf,
  318.     TPrStatus *prStatus)
  319.     = {0x2F3C,0x6005,0x1480,0xA8FD};
  320. pascal short PrError(void)
  321.     = {0x2F3C,0xBA00,0x0000,0xA8FD};
  322. pascal void PrSetError(short iErr)
  323.     = {0x2F3C,0xC000,0x0200,0xA8FD};
  324. pascal void PrGeneral(Ptr pData)
  325.     = {0x2F3C,0x7007,0x0480,0xA8FD};
  326. pascal void PrDrvrOpen(void)
  327.     = {0x2F3C,0x8000,0x0000,0xA8FD};
  328. pascal Boolean PrDlgMain(THPrint hPrint,PDlgInitProcPtr pDlgInit)
  329.     = {0x2F3C,0x4A04,0x0894,0xA8FD};
  330. pascal void PrDrvrClose(void)
  331.     = {0x2F3C,0x8800,0x0000,0xA8FD};
  332. pascal TPPrDlg PrJobInit(THPrint hPrint)
  333.     = {0x2F3C,0x4404,0x0410,0xA8FD};
  334. pascal void PrCtlCall(short iWhichCtl,long lParam1,long lParam2,long lParam3)
  335.     = {0x2F3C,0xA000,0x0E00,0xA8FD};
  336. pascal TPPrDlg PrStlInit(THPrint hPrint)
  337.     = {0x2F3C,0x3C04,0x040C,0xA8FD};
  338. #ifdef __cplusplus
  339. }
  340. #endif
  341.  
  342. #endif
  343.